var starType = ["红","绿","蓝","黄","紫"];
// 放100个星星
var bigStar = [];
for (var i = 0; i < 20; i++) {
    for (var j = 0; j < starType.length; j++) {
        bigStar.push(starType[j]);
    }
}
// 打乱星盘

for (var i = 0; i < bigStar.length; i++) {
    // 产生一个a的随机下标（0，9）
    var rndIndex = Math.floor(Math.random()*bigStar.length)
    // 交换a[i]和a[rndIndex]
    var c = bigStar[i];
    bigStar[i] = bigStar[rndIndex];
    bigStar[rndIndex] = c;
}
// 输出星盘
var ret = "";
for (var i = 0; i < bigStar.length; i++) {
    ret+=bigStar[i];
    if (i%10 === 9) {
        ret+="\n";
    }
}
console.log(ret);

